<template>
  <div class="cart">
    <nav-bar class="navbar">
      <div slot="center">购物车({{cartLength}})</div>
    </nav-bar>
    <scroll class="cart-scroll" ref="cartScroll">
      <cart-list></cart-list>
    </scroll>
    <cart-bottom-bar></cart-bottom-bar>
  </div>
</template>

<script>
import NavBar from "components/common/navbar/NavBar.vue";
import Scroll from "components/common/scroll/Scroll.vue";

import CartList from "./childComp/CartList"
import CartBottomBar from "./childComp/CartBottomBar"

import { mapGetters } from 'vuex'

export default {
  name: "Cart",
  computed: {
    ...mapGetters([
      'cartLength',
      // ...
    ])
  },
  components: {
    NavBar,
    Scroll,
    CartList,
    CartBottomBar
  },
   activated(){
      this.$refs.cartScroll.refresh();
  }
};
</script>

<style scoped>
.cart{
  height: 100vh;
}
.navbar{
  font-size: 16px;
  color:#fff;
  background-color: var(--color-tint);
}
.cart-scroll{
  height:calc(100% - 93px - 40px) ;
  overflow: hidden;
}
</style>